package com.itheima.service.impl;

import com.itheima.dao.AdminDao;
import com.itheima.domain.Admin;
import com.itheima.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service(value = "adminService")
public class AdminServiceImpl implements AdminService {


    @Autowired
    @Qualifier(value = "adminDao")
    private AdminDao adminDao;

    public void setAdminDao(AdminDao adminDao) {
        this.adminDao = adminDao;
    }

    @Override
    public List<Admin> findAll() {
        List<Admin> all = adminDao.findAll();
        return all;
    }

    @Override
    public Admin findOne(Integer id) {
        Admin one = adminDao.findOne(id);
        return one;
    }

    @Override
    public Integer save(Admin admin) {
        Integer save = adminDao.save(admin);
        return save;
    }

    @Override
    public Integer update(Admin admin) {
        Integer update = adminDao.update(admin);
        return update;
    }

    @Override
    public Integer delete(Integer id) {
        Integer delete = adminDao.delete(id);
        return delete;
    }
}
